package sddz.foodmanage.utils;

import sddz.foodmanage.fragment.HomeFragment;
import sddz.foodmanage.fragment.InpurchasingFragment;
import sddz.foodmanage.fragment.MyFragment;
import sddz.foodmanage.fragment.OrderformFragment;

/**
 * @Date:2019/7/8
 * @Author:lbb
 */

public class GlobalParms {
    private static HomeFragment sHomeFragment; //主页fragemnt
    private static InpurchasingFragment inpurchasingFragment; //走势图fragemnt
    private static OrderformFragment orderformFragment; //资讯fragemnt
    private static MyFragment myFragment; //其它fragemnt
    public static ChangeFragment sChangeFragment;  //改变选中Frangment的接口

    /**
     * 获取主页Fragment
     *
     * @return
     */
    public static HomeFragment getHomeFragment() {
        if (sHomeFragment == null) {
            sHomeFragment = new HomeFragment();
        }
        return sHomeFragment;
    }

    /**
     * 走势图fragemnt
     *
     * @return
     */
    public static InpurchasingFragment getChartsFragment() {
        if (inpurchasingFragment == null) {
            inpurchasingFragment = new InpurchasingFragment();
        }
        return inpurchasingFragment;
    }

    /**
     * 资讯fragemnt
     *
     * @return
     */
    public static OrderformFragment getZiXunFragment() {
        if (orderformFragment == null) {
            orderformFragment = new OrderformFragment();
        }
        return orderformFragment;
    }

    /**
     * //其它fragemnt
     *
     * @return
     */
    public static MyFragment getOtherFragment() {
        if (myFragment == null) {
            myFragment = new MyFragment();
        }
        return myFragment;
    }

    /**
     * 设置被选中的Fragment
     * @param changeFragment
     */
    public static void setFragmentSelected(ChangeFragment changeFragment) {
        sChangeFragment = changeFragment;

    }
}
